import type { getParkRes, EmptyObjectParams, parkIndustryRes, parkParams, parkRes, EditorParkParams, BuildParams, RentBuildRes, RentDetialRes, EnterPriseDetailRes } from "@/types/park";
import service, { request } from "@/utils/reuqest";
export const parkAPI=(data:parkParams)=>{
return request<parkRes>('park/enterprise','GET',data)
}
export const parkIndustryAPI=()=>{
  return request<parkIndustryRes[]>('park/industry')
}
export const addParkAPI=(data:EmptyObjectParams)=>{
  return request('park/enterprise','POST',data)
}
export const editParkAPI=(id:string)=>{
  return request<getParkRes>(`/park/enterprise/${id}`,'GET')
}
export const updateParkAPI=(data:EditorParkParams)=>{
  return request('park/enterprise','PUT',data)
}
export const deleteParkAPI=(id:number)=>{
  return request(`/park/enterprise/${id}`,'DELETE')
}
export const rentBUildAPI=()=>{
  return request<RentBuildRes[]>('park/rent/building','GET')
}
export const BuildAPI = (data: BuildParams) => {
  return request('/park/enterprise/rent','POST',data)
}
export const getRentDetailAPI=(id:number)=>{
  return request<RentDetialRes[]>(`park/enterprise/rent/${id}`,'GET')
}
export const exitRentAPI=(id:string)=>{
  return request(`park/enterprise/rent/${id}`,'PUT')
}
export const delRentAPI=(id:string)=>{
  return request(`park/enterprise/rent/${id}`,'DELETE')
}
export const EnterPriseDetailAPI=(id:string)=>{
  return request<EnterPriseDetailRes>(`park/enterprise/${id}`,'GET')
}
export const downloadAPI=(id:number)=>{
  return service.request<null,Blob>({
    url:`/download/${id}`,
    method:'GET',
    responseType:'blob'
  })

}